package com.search.service;

import org.springframework.stereotype.Service;

@Service
public class Add5Service {


    ThreadLocal<Integer> num =  ThreadLocal.withInitial(() -> 0);

    public int add() throws InterruptedException {
        do{
            int value = num.get();
            value++;
            num.set(value);
            Thread.sleep(100);
        }while (num.get()<50);

       return num.get();
    }
}
